import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ChDoctorTheoryVO, ChDoctorTheoryForm, ChDoctorTheoryQuery } from '@/api/system/chDoctorTheory/types';

/**
 * 查询中医理论库信息列表
 * @param query
 * @returns {*}
 */

export const listChDoctorTheory = (query?: ChDoctorTheoryQuery): AxiosPromise<ChDoctorTheoryVO[]> => {
  return request({
    url: '/system/chDoctorTheory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询中医理论库信息详细
 * @param theoryId
 */
export const getChDoctorTheory = (theoryId: string | number): AxiosPromise<ChDoctorTheoryVO> => {
  return request({
    url: '/system/chDoctorTheory/' + theoryId,
    method: 'get'
  });
};

/**
 * 新增中医理论库信息
 * @param data
 */
export const addChDoctorTheory = (data: ChDoctorTheoryForm) => {
  return request({
    url: '/system/chDoctorTheory',
    method: 'post',
    data: data
  });
};

/**
 * 修改中医理论库信息
 * @param data
 */
export const updateChDoctorTheory = (data: ChDoctorTheoryForm) => {
  return request({
    url: '/system/chDoctorTheory',
    method: 'put',
    data: data
  });
};

/**
 * 删除中医理论库信息
 * @param theoryId
 */
export const delChDoctorTheory = (theoryId: string | number | Array<string | number>) => {
  return request({
    url: '/system/chDoctorTheory/' + theoryId,
    method: 'delete'
  });
};
